home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 April / Ahoy_Magazine_87-04_1987_Double_L.d64 / Crossed Ladders (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  472b  |  21 lines

  1. 0 print"[147]":poke646,1:poke53280,0:poke53281,0
  2. 1 rem ==================================
  3. 2 rem    commodares problem #36-4 :
  4. 3 rem    crossed ladders
  5. 4 rem    solution by
  6. 5 rem    andy young
  7. 6 rem ==================================
  8. 10 ll=30 : ls=20 : ht=6 : k=2
  9. 20 x0=1 :rem initial value
  10. 30 print "x0, gx, hx"
  11. 100 for ii=0 to -1 step -1
  12. 110 hs=sqr(ls*ls-x0*x0)
  13. 120 hl=sqr(ll*ll-x0*x0)
  14. 130 hx=hs*hl/(hs+hl)
  15. 140 fx=ht-hx
  16. 150 gx=x0-fx/k
  17. 160 print x0,gx,hx
  18. 170 x0=gx
  19. 180 ii=(abs(fx/gx) < 1e-8)
  20. 190 next ii
  21.